<script>
	import Header from "@/components/Header.vue"
	export default {
		components: {
			Header
		},
		data() {
			return {
				finish: false, //是否结束
				id: 0,
				payType: 0,
				title: "详细信息",
				item: {},
				ziyuan: {},
				ziyuan_find: {},
			}
		},
		onLoad(options) {
			this.id = options.id
			this.index()
		},
		methods: {
			index() {
				var that = this
				uni.request({
					url: getApp().globalData.host + '/api/Order/getSignOrderInfo',
					data: {
						sign_id: that.id
					},
					header: {
						memberid: uni.getStorageSync('member_id'),
						membertoken: uni.getStorageSync('member_token'),
					},
					success: (r) => {
						that.item = r.data.data
						console.log(that.item)
					},
				})
			},
			goTo(url) {
				uni.navigateTo({
					url: url
				})
			},
			xiansuo() {
				var that = this
				uni.request({
					url: getApp().globalData.host + '/api/Seek/getSignInfo',
					data: {
						sign_id: that.id
					},
					header: {
						memberid: uni.getStorageSync('member_id'),
						membertoken: uni.getStorageSync('member_token'),
					},
					success: (r) => {
						that.item = r.data.data
						console.log(that.item)
					},
				})
			},
			pay(item) {

			},
			payorder() {
				var that = this
				if (that.payType == 0) {
					var pay_sign_money = that.item.seek_money * 0.5
				} else {
					var pay_sign_money = that.item.seek_money
				}
				uni.request({
					url: getApp().globalData.host + '/api/Seek/ascionPaySign',
					data: {
						sign_id: that.id,
						pay_sign_money: pay_sign_money
					},
					header: {
						memberid: uni.getStorageSync('member_id'),
						membertoken: uni.getStorageSync('member_token'),
					},
					success: (r) => {
						if (r.data.code == 200) {
							if (that.payType == 0) {
								uni.showToast({
									title: r.data.msg
								})
							} else {
								var orderInfo = r.data.data.info
								var seek_order_number = r.data.data.seek_order_number
								wx.requestPayment({
									timeStamp: orderInfo.timeStamp,
									nonceStr: orderInfo.nonceStr,
									package: orderInfo.package,
									signType: orderInfo.signType,
									paySign: orderInfo.paySign,
									success(res) {
										uni.showToast({
											title: '支付成功',
											icon: 'none',
											duration: 2000,
											success() {

											}
										})
									},
									fail() {
										uni.showToast({
											title: '取消支付',
											icon: 'none',
											duration: 2000,
											success() {

											}
										})
									}
								})
							}
						} else {
							uni.showModal({
								content: r.data.msg
							})
						}
					},
				})
			}
		}
	}
</script>
<template>
	<view class="p-30 custom-bg">
		<Header :title="title" />
		<div class="p-25 bg-white rounded-30 flex mb-18" v-if="title != '资源库匹配详情'">
			<div class="avatar flex-shirnk-0 w-80 h-80">
				<image :src="item.me_img" mode="aspectFill" class="w-full h-full rounded-full"></image>
			</div>
			<div class="flex flex-col ml-20 items-start">
				<div class="fz32 text-gray-16 flex">
					{{item.me_nick_name}}
					<div class="bg-purple fz22 text-white px-20 py-5 ml-20 rounded-30">提供茶水费：{{item.seek_money}}</div>
				</div>
				<div class="fz24 text-gray-a4 mt-10">发布时间：{{item.add_time}}</div>
			</div>
		</div>


		<!-- ======================需求相关 start ====================== -->
		<div class="p-25 bg-white rounded-30  mb-18">
			<div class="text-purple fz28 mb-18" style="color: red;">
				-状态-
			</div>
			<div class="fz28 text-gray-16">
				<div class="mb-10">{{item.status_word}}</div>
			</div>
		</div>
		
		

		<div class="p-25 bg-white rounded-30  mb-18">
			<div class="text-purple fz28 mb-18">
				-基本信息-
			</div>
			<div class="fz28 text-gray-16">
				<block v-if="title != '资源库匹配详情'">
					<div v-for="(it,ind) in item.jb_seek_info" class="mb-10">{{it}}</div>
				</block>
				<block v-else>
					<div class="fz28 text-gray-16" v-for="(item,index) in ziyuan_find.jb_resource_info">
						<div class="mb-20">{{item}}</div>
					</div>
				</block>
			</div>
		</div>

		<div class="p-25 bg-white rounded-30  mb-18" v-if="title != '资源库匹配详情'">
			<div class="text-orange fz28 mb-18">
				-需求-
			</div>
			<div class="fz28 text-gray-16">
				<div>{{item.seek_type_word}}</div>
			</div>
		</div>

		<div class="p-25 bg-white rounded-30  mb-18" v-if="title != '资源库匹配详情'">
			<div class="text-yellow fz28 mb-18">
				-图片信息-
			</div>
			<div class="flex" >
				<image v-for="(it,ind) in item.seek_img_arr" :src="it" mode="aspectFill" style="margin-right: 5%;" class="w-165 h-165 rounded-22">
				</image>
			</div>
		</div>

		<!-- ====================== 需求相关 end ====================== -->


		<!-- ======================线索相关 start====================== -->
		<div class="p-25 bg-white rounded-30  mb-18" v-if="title == '提供线索详情'">
			<div class="text-red fz28 mb-18">
				-线索信息-
			</div>
			<div class="flex mt-25">
				<image :src="item.sign_me_img" mode="aspectFill" class="w-90 h-90 rounded-full"></image>
				<div class="fz28 text-gray-16 ml-16 ">
					<div>{{item.sign_me_nick_name}}</div>
					<div class="mt-10">电话：{{item.sign_phone}}</div>
				</div>
			</div>

			<div class="text-yellow fz28 mb-18 mt-30">
				-线索图片-
			</div>
			<div class="flex" style="justify-content:space-around;">
				<image :src="item" mode="aspectFill" class="w-165 h-165 rounded-22"
					v-for="(item,index) in item.sign_img_arr"></image>
				<!-- <image src="../../static/logo.png" mode="aspectFill" class="w-165 h-165 rounded-22"></image>
				<image src="../../static/logo.png" mode="aspectFill" class="w-165 h-165 rounded-22"></image> -->
			</div>


			<!-- 寻其他 用这个标题 -->
			<div class="text-blue fz28 mb-18 mt-30">
				-线索描述-
			</div>
			<div class="fz28 text-gray-16">
				{{item.sign_content}}
			</div>
		</div>


		<!-- ======================线索相关 end====================== -->


		<div class="p-25 bg-white rounded-30  mb-18" v-if="title == '提供线索详情'&&item.seek_money>0">
			<div class="text-green fz28 mb-18">
				-线索支付-
			</div>
			<div class="flex" style="justify-content: space-around;">

				<div class="w-220 h-180   rounded-22 bg-gray-800  flex-col center " :class="{'custom-input':payType==0}"
					@click="payType=0">
					<div class="fz34 font-bold" @click="pay(item)">支付50%</div>
					<div class="fz30 mt-13" @click="pay(item)">{{item.seek_money*0.5}}元</div>
				</div>
				<div class="w-220 h-180   rounded-22 bg-gray-800  flex-col center" :class="{'custom-input':payType==1}"
					@click="payType=1">
					<div class="fz34 font-bold" @click="pay(item)">全额付款</div>
					<div class="fz30 mt-13" @click="pay(item)">{{item.seek_money}}元</div>
				</div>
			</div>
		</div>



		<div class="p-25 bg-white rounded-30  mb-18">
			<!-- 除了其他 用这个标题 -->
			<block v-if="title != '资源库匹配详情'">
				<div class="text-blue fz28 mb-18">
					-更多信息-
					<div v-for="(it,ind) in item.gd_seek_info">{{it,ind}}</div>
				</div>
			</block>
			<block v-else>
				<div class="text-blue fz28 mb-18">
					-更多信息-
				</div>
				<div class="fz28 text-gray-16" v-for="(item,index) in ziyuan_find.gd_resource_info">
					<div class="mb-20">{{item}}</div>
				</div>
			</block>

		</div>



		<!-- 判断看自己要隐藏按钮 -->
		<div class="submit  text-white p-30 bg-white">
			<label class="radio flex text-gray-16 mb-30 ml-20 fz24" v-if="title == '提供线索详情'&&item.seek_money>0">
				<radio color="#AC5FF8" /><text>支付前请同意<text class="text-purple">《云账户灵活用工协议》</text> <text class="text-purple">《用户行为规范》</text></text>
			</label>
			<div v-if="title == '提供线索详情'&&item.seek_money>0" class="bg-purple center h-90 rounded-50"
				@click="payorder(item)">
				立即支付
			</div>
			<div class="bg-purple center h-90 rounded-50" @click="goTo('/pages/detail/receive/receive?id='+id)"
				v-if="item.is_teafee_button==1">
				领取茶水费
			</div>

			<div class="bg-purple center h-90 rounded-50" v-if="finish" @click="deleteItem()">
				删除
			</div>
		</div>

		<div style="height: 300rpx;"></div>

	</view>
</template>



<style>
	.submit {
		position: fixed;
		bottom: 0;
		left: 0;
		width: 100%;
		box-shadow: 0 -10rpx 10rpx rgba(0, 0, 0, 0.05);
	}

	page {
		background-color: #F8F8F8;
	}
</style>